#!/usr/bin/env python3.9
# -*- encoding: utf-8 -*-
"""
@文件        :models.py
@说明        : 订单相关模型
@时间        :2022/12/03 18:31:41
@作者        :Mars
@版本        :1.0
"""

from django.db import models

from mars.apps.users.models import User
from mars.utils.models import BaseModel


# Create your models here.
class Order(BaseModel):
    """订单模型"""

    order_no = models.CharField(max_length=32, verbose_name="订单编号")
    func_name = models.CharField(max_length=32, verbose_name="项目名称")
    price = models.DecimalField(max_digits=5, decimal_places=2, verbose_name="项目价格")
    num = models.IntegerField(default=1, verbose_name="数量")
    total = models.DecimalField(max_digits=8, decimal_places=2, verbose_name="总额")
    user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="用户")
    status = models.SmallIntegerField(
        default=0, choices=[(0, "未付"), (1, "已付")], verbose_name="状态"
    )

    class Meta:
        db_table = "tb_order"
        verbose_name = "订单"
        verbose_name_plural = verbose_name
